package com.eastfair.transport.service.impl;

import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.transport.service.TransportExhibitionCompanyService;
import com.eastfair.venuebooking.api.ExhibitionCompanyFeign;
import com.eastfair.venueservice.vo.ExhibitionCompanyVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 展会企业服务.
 *
 * @author dqq
 * @date 2022 /10/8
 */
@Service
@Slf4j
public class TransportExhibitionCompanyServiceImpl implements TransportExhibitionCompanyService {

    @Resource
    private ExhibitionCompanyFeign exhibitionCompanyFeign;

    @Override
    public ExhibitionCompanyVO getByServiceProviderId(Long serviceProviderId, Long exhibitionMangeId) {
        log.info("getByServiceProviderId - 服务商ID查询展会企业VO, serviceProviderId={}, exhibitionMangeId={}",
                serviceProviderId, exhibitionMangeId);
        R<ExhibitionCompanyVO> result = exhibitionCompanyFeign.getByServiceProviderId(serviceProviderId, exhibitionMangeId);
        log.info("getByServiceProviderId - 完成, result={}", result);
        if (!result.getIsSuccess()) {
            throw BizException.wrap(result.getCode(), result.getMsg());
        }
        return result.getData();
    }
}